//
//  DXTools.swift
//  weiBoOfSwift
//
//  Created by simon on 15/12/5.
//  Copyright © 2015年 simon. All rights reserved.
//

import UIKit
import SVProgressHUD
let KChangeRootController = "changeRootController"
let emotionButtonDidSelectedNotifity = "emotionButtonDidSelectedNotifity"
let KEmotionButtonDetele = "KEmotionButtonDetele"
let KStatuesCellMargin:CGFloat = 10
let kstatuesFontSize:CGFloat = 14
let KScreenW = UIScreen.mainScreen().bounds.width
let KScreenH = UIScreen.mainScreen().bounds.height
let emotonsPageOfNum = 20
    /**
    *  返回颜色
    */  func RGBCorlor(R R:CGFloat, G:CGFloat, B:CGFloat)->(UIColor)
{
        
 return UIColor(red:R/255, green: G/255, blue: B/255, alpha: 1)
}
    /**
    *  返回随机颜色
    */
 func randomCorlor()->(UIColor)
{
        
return RGBCorlor(R:CGFloat(random()%256), G:CGFloat(random()%256), B: CGFloat(random()%256))
        
}
    /**
    *  返回归档路径
    */
 func keyedArchiverPath(fieldName:String)->(String) {
     let baseString =
    (NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true).last!) as NSString
        
      return  baseString.stringByAppendingPathComponent(fieldName)
    
    }
/**
 * 返回子字符串在父字符串中的range
 */
func subStringRangeOfStr(str str:String,subString:String)->(NSRange) {
    let str_ns = str as NSString
    let range =  str_ns.rangeOfString(subString, options: NSStringCompareOptions.CaseInsensitiveSearch)
    return range
}
/**
 调试信息的打印
 */
func logPrint<T>(
    message: T,
    file: String = __FILE__,
    line: Int = __LINE__,
    mthName: String = __FUNCTION__
    ) {
        
        #if DEBUG
            __LINE__
            print("\((file as NSString).lastPathComponent)[\(line)], \(mthName): \(message)")
        #endif
}

